package inet.app.controller.parser;


import inet.app.controller.connect.JsonParser;
import inet.app.model.object.UsrLogin_item;

import java.util.ArrayList;

import org.json.JSONObject;

import android.util.Log;

public class Parser_UsrLogin {


	private ArrayList<UsrLogin_item> list = new ArrayList<UsrLogin_item>();
	private UsrLogin_item item;
	private String USRLOGIN = "usrlogin";
	private String STATUS = "status";
	private String VERIFIED = "verified";
	private String USR = "usr";
	
	public Parser_UsrLogin () {
		
	}
	public ArrayList<UsrLogin_item> getList(String url) {
		list = new ArrayList<UsrLogin_item>();
		JSONObject jobject,object,job_items;
		JsonParser jParser = new JsonParser();
		jobject = jParser.getJSONFromUrl(url);
		try {
				String usrlogin = jobject.getString(USRLOGIN);
				
				if(!usrlogin.equals("")){
					object = new JSONObject(usrlogin);
					String status= object.getString(STATUS);
					String verified= object.getString(VERIFIED);
					String usr= object.getString(USR);
					item = new UsrLogin_item(status, verified, usr);
					list.add(item);
				}else {
					list=null;
				}
			return list;
        } catch (Exception e) {
            Log.e("JSON Parser", "Error parsing data " + e.toString());
            return null;
        }
		
	}


}
